import type { Column } from "@/components/CrudPage/type";
import StatusTag from "@/components/SRComponents/StatusTag/index.vue";

export function useSysDeptProvider() {
  // 列配置
  const columns: Column[] = [
    {
      label: "部门名称",
      slot: "deptName",
      prop: "deptName",
      create: true,
      edit: true
    },

    {
      label: "是否为默认部门",
      slot: "isDefault",
      prop: "isDefault",
      create: true,
      edit: true,
      hide: true
    },
    {
      label: "负责人",
      slot: "leader",
      prop: "leader",
      create: true,
      edit: true,
      cellRenderer: ({ row }) => <span>{row.leader?.nickName || "-"}</span>
    },

    {
      label: "状态",
      slot: "status",
      prop: "status",
      create: true,
      edit: true,
      cellRenderer: ({ row }) => <StatusTag status={row.status} />
    },
    {
      label: "排序",
      slot: "order",
      prop: "order",
      create: true,
      edit: true
    },
    {
      label: "操作",
      prop: "operation",
      slot: "operation"
    }
  ];

  return {
    columns
  };
}
